package com.quotes;

import java.util.ArrayList;
import java.util.List;

public class ParametersList 
{
	private List<Parameters> list = new ArrayList<Parameters>();
	
	public ParametersList() {
	}
	
	public void add(Parameters p) {
		list.add(p);
	}
	
	public List<Parameters> getParameters() {
		return list;
	}
	
	public ParametersList multiply(String key, double[] values) {
		ParametersList result = new ParametersList();
		
		for (Parameters existingParameters : list) {
			for (double value : values) {
				result.add(existingParameters.clone());
				result.lastElement().set(key, value);
			}
		}
		
		return result;
	}
	
	public ParametersList multiply(String key, int[] values) {
		ParametersList result = new ParametersList();
		
		for (Parameters existingParameters : list) {
			for (int value : values) {
				result.add(existingParameters.clone());
				result.lastElement().set(key, value);
			}
		}
		
		return result;
	}
	
	public ParametersList multiply(String key, boolean[] values) {
		ParametersList result = new ParametersList();
		
		for (Parameters existingParameters : list) {
			for (boolean value : values) {
				result.add(existingParameters.clone());
				result.lastElement().set(key, value);
			}
		}
		
		return result;
	}
	
	public ParametersList multiply(String key, String[] values) {
		ParametersList result = new ParametersList();
		
		for (Parameters existingParameters : list) {
			for (String value : values) {
				result.add(existingParameters.clone());
				result.lastElement().set(key, value);
			}
		}
		
		return result;
	}
	
	public Parameters get(int index) {
		return list.get(index);
	}
	
	public Parameters lastElement() {
		return list.get(list.size() - 1);
	}
	
	public int size() {
		return list.size();
	}
	
	public String toString() {
		String result = "";
		
		for (Parameters p : list) {
			result += p.toString() + "\n";
		}
		
		return result;
	}
}
